export default {
  data() {
    return {
      dialogTitle: '',
      dialogName: '',
      dialogProps: {},
      dialogVisible: false,
    };
  },

  watch: {
    dialogName(dialogName) {
      this.dialogVisible = !_.isEmpty(dialogName);
    },
    dialogVisible(current) {
      if (!current) {
        this.dialogProps = {};
        this.dialogName = '';
      }
    },
  },

  methods: {
    submitFinished() {
      this.dialogName = '';
      if (this.doGet) {
        this.doGet({ action: 'getGrid' });
      }
    },

    openDialog({ props = {}, dialogName }) {
      this.dialogProps = _.cloneDeep(props);
      this.dialogName = dialogName;
    },
    closeDialog() {
      this.dialogVisible = false;
    },
  },

};
